home *** CD-ROM | disk | FTP | other *** search
- head 1.2;
- branch ;
- access ;
- symbols ;
- locks ; strict;
- comment @ * @;
-
-
- 1.2
- date 89.03.22.16.06.53; author rab; state Exp;
- branches ;
- next 1.1;
-
- 1.1
- date 88.07.22.09.00.17; author ouster; state Exp;
- branches ;
- next ;
-
-
- desc
- @@
-
-
- 1.2
- log
- @*** empty log message ***
- @
- text
- @/*
- * strcspn.c --
- *
- * Source code for the "strcspn" library routine.
- *
- * Copyright 1988 Regents of the University of California
- * Permission to use, copy, modify, and distribute this
- * software and its documentation for any purpose and without
- * fee is hereby granted, provided that the above copyright
- * notice appear in all copies. The University of California
- * makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without
- * express or implied warranty.
- */
-
- #ifndef lint
- static char rcsid[] = "$Header: /sprite/src/lib/c/string/RCS/strcspn.c,v 1.1 88/07/22 09:00:17 ouster Exp Locker: rab $ SPRITE (Berkeley)";
- #endif /* not lint */
-
- #include <string.h>
-
- /*
- *----------------------------------------------------------------------
- *
- * strcspn --
- *
- * Count how many of the leading characters there are in "string"
- * before there's one that's also in "chars".
- *
- * Results:
- * The return value is the index of the first character in "string"
- * that is also in "chars". If there is no such character, then
- * the return value is the length of "string".
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
- int
- strcspn(string, chars)
- char *string; /* String to search. */
- char *chars; /* Characters to look for in string. */
- {
- register char c, *p, *s;
-
- for (s = string, c = *s; c != 0; s++, c = *s) {
- for (p = chars; *p != 0; p++) {
- if (c == *p) {
- return s-string;
- }
- }
- }
- return s-string;
- }
- @
-
-
- 1.1
- log
- @Initial revision
- @
- text
- @d17 4
- a20 2
- static char rcsid[] = "$Header: strlen.c,v 1.3 88/07/02 14:33:08 ouster Exp $ SPRITE (Berkeley)";
- #endif not lint
- @
-